package com.wish.wishhouse_resource.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wish.wishhouse_resource.entity.TMTenant;
import com.wish.wishhouse_resource.service.ITMTenantService;
import dto.houseResourceDto.TenantDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vo.ResultEntity;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhangshuxin
 * @since 2021-03-27
 */
@RestController
@RequestMapping("/tMTenant")
public class TMTenantController {

    @Autowired
    private ITMTenantService itmTenantService;

    //列表展示
    @RequestMapping("/list")
    public ResultEntity list(TenantDto tenantDto) {
        //分页
        PageHelper.startPage(tenantDto.getPageNum(), tenantDto.getPageSize());
        //查询
        List<TMTenant> list = itmTenantService.listAll(tenantDto);
        //封装
        PageInfo<TMTenant> info = new PageInfo<>(list);
        return ResultEntity.ok("200", "列表查询成功", info);
    }
}

